function setCookie(cname,cvalue,exdays)
{
  var d = new Date();
  d.setTime(d.getTime()+(exdays*24*60*60*1000));
  var expires = "expires="+d.toGMTString();
  document.cookie = cname + "=" + cvalue + "; " + expires;
}


$(".select1").click(function(){
	$('.select2').removeClass('border');
	$('.select3').removeClass('border');
	$('.select4').removeClass('border');
	$('.select5').removeClass('border');
	$('.select1').addClass('border');
    $("#t2").css("display",'inline');
	$("#t1").css("display",'inline');
	$("#t4").css("display",'inline');
	$("#t3").css("display",'none');
	
})
$(".select2").click(function(){
	$('.select1').removeClass('border');
	$('.select3').removeClass('border');
	$('.select4').removeClass('border');
	$('.select5').removeClass('border');
	$('.select2').addClass('border');
	$("#t2").css("display",'none');
	$("#t1").css("display",'inline');
	$("#t3").css("display",'none');
	$("#t4").css("display",'none');	
	
})
$(".select3").click(function(){
	$('.select1').removeClass('border');
	$('.select2').removeClass('border');
	$('.select4').removeClass('border');
	$('.select5').removeClass('border');
	$('.select3').addClass('border');
	$("#t2").css("display",'none');
	$("#t3").css("display",'inline');
	$("#t1").css("display",'none');	
	$("#t4").css("display",'none');	
	
})
$(".select4").click(function(){
	$('.select1').removeClass('border');
	$('.select3').removeClass('border');
	$('.select2').removeClass('border');
	$('.select5').removeClass('border');
	$('.select4').addClass('border');
	$("#t2").css("display",'none');
	$("#t3").css("display",'inline');
	$("#t1").css("display",'none');	
	$("#t4").css("display",'none');	
})
$(".select5").click(function(){
	$('.select1').removeClass('border');
	$('.select3').removeClass('border');
	$('.select4').removeClass('border');
	$('.select2').removeClass('border');
	$('.select5').addClass('border');
	$("#t1").css("display",'none');
	$("#t2").css("display",'inline');
	$("#t3").css("display",'none');	
	$("#t4").css("display",'none');	
	
})

	$('.container-div').click(function(){
		$('.container-div').css('display','none');

	})
	$('.i3').click(function(){
		$('.container').css('display','none');
		$('.shade').css('display','none');
       $('.container').html('');
       $('.container-a').css('display','none');
        $('.i3').css('display','none');
	})
/*
 *清新风格
 */
$('.whole2').click(function(){
	$('.container').css('display','inline');
	$('.shade').css('display','inline');
	$('.container-div').css('display','inline');
	$('.container-a').css('display','inline');
    $('.i3').css('display','inline');
	$('#style').val(2);
	qixing();
	dadd();
})
/*
 *亲子风格
 *
 */
$('.whole3').click(function(){
	$('.container').css('display','inline');
	$('.shade').css('display','inline');
	$('.container-div').css('display','inline');
	$('.container-a').css('display','inline');
    $('.i3').css('display','inline');
    $('#style').val(1);
	qinzi();
	dadd1();
})
//简约风格
$('.whole4').click(function(){
	$('.container').css('display','inline');
	$('.shade').css('display','inline');
	$('.container-div').css('display','inline');
	$('.container-a').css('display','inline');
    $('.i3').css('display','inline');
    $('#style').val(3);
	jianyue();
	dadd2();
})
//style=2
function qixing(){
	$('.container').html('')
	var page='';
	page+=' <b class="container-b">清新风格</b>';			
	page+='<div id="slide" class="slide" class="index-slide" alt="star">'	      
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/fresh/m1.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/fresh/m2.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/fresh/m3.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/fresh/m4.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/fresh/m5.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/fresh/m6.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/fresh/m7.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/fresh/m8.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/fresh/m9.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/fresh/m10.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/fresh/m11.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/fresh/m12.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/fresh/m13.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/fresh/m14.jpg"/></div>';
//  page+='<div class="slide-bt"></div>';
    page+='</div>';
   var c=  $('.container').html(page);
    // console.log(c);
}
//style=1
function qinzi(){
	$('.container').html('')
	var page='';
	page+=' <b class="container-b">宝宝哥风格</b>';
	page+='<div id="slide1" class="slide1" class="index-slide1" alt="star">'	      
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/parentOffspring/M1.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/parentOffspring/M2.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/parentOffspring/M3.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/parentOffspring/M4.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/parentOffspring/M5.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/parentOffspring/M6.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/parentOffspring/M7.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/parentOffspring/M8.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/parentOffspring/M9.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/parentOffspring/M10.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/parentOffspring/M11.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/parentOffspring/M12.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/parentOffspring/M13.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/parentOffspring/M14.jpg"/></div>';  
//  page+='<div class="slide1-bt1"></div>';
    page+='</div>';
   var c=  $('.container').html(page);
    // console.log(c);
}
//style=3
function jianyue(){
	$('.container').html('')
	var page='';
	page+=' <b class="container-b">LS-简约风格</b>';
	page+='<div id="slide2" class="slide2" class="index-slide2" alt="star">'	      
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/concise/m1.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/concise/m2.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/concise/m3.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/concise/m4.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/concise/m5.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/concise/m6.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/concise/m7.jpg"/></div>'; 
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/concise/m8.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/concise/m9.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/concise/m10.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/concise/m11.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/concise/m12.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/concise/m13.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/concise/m14.jpg"/></div>'; 
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/concise/m15.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/concise/m16.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/concise/m17.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/concise/m18.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/concise/m19.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/concise/m20.jpg"/></div>';
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/concise/m21.jpg"/></div>'; 
	page+='<div class="img"><img src="http://www.youyiku-yishu.cn/Apps/WebApp/View/default/images/photoNewBook/concise/m22.jpg"/></div>'; 
//  page+='<div class="slide2-bt2"></div>';
    page+='</div>';
   var c=  $('.container').html(page);
    // console.log(c);
}
//轮播图
function dadd2(){
	
	var autoLb = false;          //autoLb=true为开启自动轮播
	var autoLbtime1 = 1;         //autoLbtime为轮播间隔时间（单位秒）
	var touch = true;           //touch=true为开启触摸滑动
	var slide1Bt = true;         //slide1Bt=true为开启滚动按钮
	
	
	var slide1Nub;               //轮播图片数量
	
	//窗口大小改变时改变轮播图宽高
	$(window).resize(function(){
	   $(".slide2").height($(".slide2").width()*0.56);
	});
	
	    $(".slide2").height($(".slide2").width()*0.56);
	    slide1Nub = $(".slide2 .img").size();             //获取轮播图片数量
	    for(i=0;i<slide1Nub;i++){
	        $(".slide2 .img:eq("+i+")").attr("data-slide2-imgId",i);
	    }
	
	    //根据轮播图片数量设定图片位置对应的class
	    if(slide1Nub==1){
	        for(i=0;i<slide1Nub;i++){
	            $(".slide2 .img:eq("+i+")").addClass("img3");
	        }
	    }
	    if(slide1Nub==2){
	        for(i=0;i<slide1Nub;i++){
	            $(".slide2 .img:eq("+i+")").addClass("img"+(i+3));
	        }
	    }
	    if(slide1Nub==3){
	        for(i=0;i<slide1Nub;i++){
	            $(".slide2 .img:eq("+i+")").addClass("img"+(i+2));
	        }
	    }
	    if(slide1Nub>3&&slide1Nub<6){
	        for(i=0;i<slide1Nub;i++){
	            $(".slide2 .img:eq("+i+")").addClass("img"+(i+1));
	        }
	    }
	    if(slide1Nub>=6){
	        for(i=0;i<slide1Nub;i++){
	            if(i<5){
	               $(".slide2 .img:eq("+i+")").addClass("img"+(i+1)); 
	            }else{
	                $(".slide2 .img:eq("+i+")").addClass("img5"); 
	            }
	        }
	    }
	
	
	    //根据轮播图片数量设定轮播图按钮数量
	    if(slide1Bt){
	        for(i=1;i<=slide1Nub;i++){
	            $(".slide2-bt2").append("<span data-slide2-bt2='"+i+"' onclick='tz("+i+")'></span>");
	            
	        }
	        $(".slide2-bt2").width(slide1Nub*34);
	        $(".slide2-bt2").css("margin-left","-"+slide1Nub*17+"px");
	    }
	
	
	    //自动轮播
	    if(autoLb){
	        setInterval(function(){
	        right();
	    }, autoLbtime1*3000);
	    }
	
	
	    if(touch){
	        k_touch();
	    }
	    slide1Li();
	    imgClickFy();
	
	
	
	//右滑动
	function right(){
	    var fy = new Array();
	    for(i=0;i<slide1Nub;i++){
	        fy[i]=$(".slide2 .img[data-slide2-imgId="+i+"]").attr("class");
	    }
	    for(i=0;i<slide1Nub;i++){
	        if(i==0){
	            $(".slide2 .img[data-slide2-imgId="+i+"]").attr("class",fy[slide1Nub-1]);
	        }else{
	           $(".slide2 .img[data-slide2-imgId="+i+"]").attr("class",fy[i-1]); 
	        }
	    }
	    imgClickFy();
	    slide1Li();
	}
	
	
	//左滑动
	function left(){
	    var fy = new Array();
	    for(i=0;i<slide1Nub;i++){
	        fy[i]=$(".slide2 .img[data-slide2-imgId="+i+"]").attr("class");
	    }
	    for(i=0;i<slide1Nub;i++){
	        if(i==(slide1Nub-1)){
	            $(".slide2 .img[data-slide2-imgId="+i+"]").attr("class",fy[0]);
	        }else{
	           $(".slide2 .img[data-slide2-imgId="+i+"]").attr("class",fy[i+1]); 
	        }
	    }
	    imgClickFy();
	    slide1Li();
	}
	
	
	//轮播图片左右图片点击翻页
	function imgClickFy(){
	    $(".slide2 .img").removeAttr("onclick");
	    $(".slide2 .img2").attr("onclick","left()");
	    $(".slide2 .img4").attr("onclick","right()");
	}
	
	
	//修改当前最中间图片对应按钮选中状态
	function slide1Li(){
	    var slide1List = parseInt($(".slide2 .img3").attr("data-slide2-imgId")) + 1;
	    $(".slide2-bt2 span").removeClass("on");
	    $(".slide2-bt2 span[data-slide2-bt2="+slide1List+"]").addClass("on");
	}
	
	
	//轮播按钮点击翻页
	function tz(id){
	    var tzcs = id - (parseInt($(".slide2 .img3").attr("data-slide2-imgId")) + 1);
	    if(tzcs>0){
	        for(i=0;i<tzcs;i++){
	            setTimeout(function(){
	              right();  
	            },1);
	        }
	    }
	    if(tzcs<0){
	        tzcs=(-tzcs);
	        for(i=0;i<tzcs;i++){
	            setTimeout(function(){
	              left();  
	            },1);
	        }
	    }
	    slide1Li();
	}
	
	
	//触摸滑动模块
	function k_touch() {
	    var _start = 0, _end = 0, _content = document.getElementById("slide2");
	    _content.addEventListener("touchstart", touchStart, false);
	    _content.addEventListener("touchmove", touchMove, false);
	    _content.addEventListener("touchend", touchEnd, false);
	    function touchStart(event) {
	        var touch = event.targetTouches[0];
	        _start = touch.pageX;
	    }
	    function touchMove(event) {
	        var touch = event.targetTouches[0];
	        _end = (_start - touch.pageX);
	    }
	
	    function touchEnd(event) {
	        if (_end < -100) {
	            left();
	            _end=0;
	        }else if(_end > 100){
	            right();
	            _end=0;
	        }
	    }
	}
}
function dadd1(){
	
	var autoLb = false;          //autoLb=true为开启自动轮播
	var autoLbtime1 = 1;         //autoLbtime为轮播间隔时间（单位秒）
	var touch = true;           //touch=true为开启触摸滑动
	var slide1Bt = true;         //slide1Bt=true为开启滚动按钮
	
	
	var slide1Nub;               //轮播图片数量
	
	//窗口大小改变时改变轮播图宽高
	$(window).resize(function(){
	   $(".slide1").height($(".slide1").width()*0.56);
	});
	
	    $(".slide1").height($(".slide1").width()*0.56);
	    slide1Nub = $(".slide1 .img").size();             //获取轮播图片数量
	    for(i=0;i<slide1Nub;i++){
	        $(".slide1 .img:eq("+i+")").attr("data-slide1-imgId",i);
	    }
	
	    //根据轮播图片数量设定图片位置对应的class
	    if(slide1Nub==1){
	        for(i=0;i<slide1Nub;i++){
	            $(".slide1 .img:eq("+i+")").addClass("img3");
	        }
	    }
	    if(slide1Nub==2){
	        for(i=0;i<slide1Nub;i++){
	            $(".slide1 .img:eq("+i+")").addClass("img"+(i+3));
	        }
	    }
	    if(slide1Nub==3){
	        for(i=0;i<slide1Nub;i++){
	            $(".slide1 .img:eq("+i+")").addClass("img"+(i+2));
	        }
	    }
	    if(slide1Nub>3&&slide1Nub<6){
	        for(i=0;i<slide1Nub;i++){
	            $(".slide1 .img:eq("+i+")").addClass("img"+(i+1));
	        }
	    }
	    if(slide1Nub>=6){
	        for(i=0;i<slide1Nub;i++){
	            if(i<5){
	               $(".slide1 .img:eq("+i+")").addClass("img"+(i+1)); 
	            }else{
	                $(".slide1 .img:eq("+i+")").addClass("img5"); 
	            }
	        }
	    }
	
	
	    //根据轮播图片数量设定轮播图按钮数量
	    if(slide1Bt){
	        for(i=1;i<=slide1Nub;i++){
	            $(".slide1-bt1").append("<span data-slide1-bt1='"+i+"' onclick='tz("+i+")'></span>");
	            
	        }
	        $(".slide1-bt1").width(slide1Nub*34);
	        $(".slide1-bt1").css("margin-left","-"+slide1Nub*17+"px");
	    }
	
	
	    //自动轮播
	    if(autoLb){
	        setInterval(function(){
	        right();
	    }, autoLbtime1*3000);
	    }
	
	
	    if(touch){
	        k_touch();
	    }
	    slide1Li();
	    imgClickFy();
	
	
	
	//右滑动
	function right(){
	    var fy = new Array();
	    for(i=0;i<slide1Nub;i++){
	        fy[i]=$(".slide1 .img[data-slide1-imgId="+i+"]").attr("class");
	    }
	    for(i=0;i<slide1Nub;i++){
	        if(i==0){
	            $(".slide1 .img[data-slide1-imgId="+i+"]").attr("class",fy[slide1Nub-1]);
	        }else{
	           $(".slide1 .img[data-slide1-imgId="+i+"]").attr("class",fy[i-1]); 
	        }
	    }
	    imgClickFy();
	    slide1Li();
	}
	
	
	//左滑动
	function left(){
	    var fy = new Array();
	    for(i=0;i<slide1Nub;i++){
	        fy[i]=$(".slide1 .img[data-slide1-imgId="+i+"]").attr("class");
	    }
	    for(i=0;i<slide1Nub;i++){
	        if(i==(slide1Nub-1)){
	            $(".slide1 .img[data-slide1-imgId="+i+"]").attr("class",fy[0]);
	        }else{
	           $(".slide1 .img[data-slide1-imgId="+i+"]").attr("class",fy[i+1]); 
	        }
	    }
	    imgClickFy();
	    slide1Li();
	}
	
	
	//轮播图片左右图片点击翻页
	function imgClickFy(){
	    $(".slide1 .img").removeAttr("onclick");
	    $(".slide1 .img2").attr("onclick","left()");
	    $(".slide1 .img4").attr("onclick","right()");
	}
	
	
	//修改当前最中间图片对应按钮选中状态
	function slide1Li(){
	    var slide1List = parseInt($(".slide1 .img3").attr("data-slide1-imgId")) + 1;
	    $(".slide1-bt1 span").removeClass("on");
	    $(".slide1-bt1 span[data-slide1-bt1="+slide1List+"]").addClass("on");
	}
	
	
	//轮播按钮点击翻页
	function tz(id){
	    var tzcs = id - (parseInt($(".slide1 .img3").attr("data-slide1-imgId")) + 1);
	    if(tzcs>0){
	        for(i=0;i<tzcs;i++){
	            setTimeout(function(){
	              right();  
	            },1);
	        }
	    }
	    if(tzcs<0){
	        tzcs=(-tzcs);
	        for(i=0;i<tzcs;i++){
	            setTimeout(function(){
	              left();  
	            },1);
	        }
	    }
	    slide1Li();
	}
	
	
	//触摸滑动模块
	function k_touch() {
	    var _start = 0, _end = 0, _content = document.getElementById("slide1");
	    _content.addEventListener("touchstart", touchStart, false);
	    _content.addEventListener("touchmove", touchMove, false);
	    _content.addEventListener("touchend", touchEnd, false);
	    function touchStart(event) {
	        var touch = event.targetTouches[0];
	        _start = touch.pageX;
	    }
	    function touchMove(event) {
	        var touch = event.targetTouches[0];
	        _end = (_start - touch.pageX);
	    }
	
	    function touchEnd(event) {
	        if (_end < -100) {
	            left();
	            _end=0;
	        }else if(_end > 100){
	            right();
	            _end=0;
	        }
	    }
	}
}
function dadd(){
	var autoLb =false;          //autoLb=true为开启自动轮播
	var autoLbtime = 1;         //autoLbtime为轮播间隔时间（单位秒）
	var touch = true;           //touch=true为开启触摸滑动
	var slideBt = true;         //slideBt=true为开启滚动按钮
	
	
	var slideNub;               //轮播图片数量
	
	//窗口大小改变时改变轮播图宽高
	$(window).resize(function(){
	   $(".slide").height($(".slide").width()*0.56);
	});
	
	    $(".slide").height($(".slide").width()*0.56);
	    slideNub = $(".slide .img").size();             //获取轮播图片数量
	    for(i=0;i<slideNub;i++){
	        $(".slide .img:eq("+i+")").attr("data-slide-imgId",i);
	    }
	
	    //根据轮播图片数量设定图片位置对应的class
	    if(slideNub==1){
	        for(i=0;i<slideNub;i++){
	            $(".slide .img:eq("+i+")").addClass("img3");
	        }
	    }
	    if(slideNub==2){
	        for(i=0;i<slideNub;i++){
	            $(".slide .img:eq("+i+")").addClass("img"+(i+3));
	        }
	    }
	    if(slideNub==3){
	        for(i=0;i<slideNub;i++){
	            $(".slide .img:eq("+i+")").addClass("img"+(i+2));
	        }
	    }
	    if(slideNub>3&&slideNub<6){
	        for(i=0;i<slideNub;i++){
	            $(".slide .img:eq("+i+")").addClass("img"+(i+1));
	        }
	    }
	    if(slideNub>=6){
	        for(i=0;i<slideNub;i++){
	            if(i<5){
	               $(".slide .img:eq("+i+")").addClass("img"+(i+1)); 
	            }else{
	                $(".slide .img:eq("+i+")").addClass("img5"); 
	            }
	        }
	    }
	
	
	    //根据轮播图片数量设定轮播图按钮数量
	    if(slideBt){
	        for(i=1;i<=slideNub;i++){
	            $(".slide-bt").append("<span data-slide-bt='"+i+"' onclick='tz("+i+")'></span>");
	            
	        }
	        $(".slide-bt").width(slideNub*34);
	        $(".slide-bt").css("margin-left","-"+slideNub*17+"px");
	    }
	
	
	    //自动轮播
	    if(autoLb){
	        setInterval(function(){
	        right();
	    }, autoLbtime*2000);
	    }
	
	
	    if(touch){
	        k_touch();
	    }
	    slideLi();
	    imgClickFy();
	
	
	
	//右滑动
	function right(){
	    var fy = new Array();
	    for(i=0;i<slideNub;i++){
	        fy[i]=$(".slide .img[data-slide-imgId="+i+"]").attr("class");
	    }
	    for(i=0;i<slideNub;i++){
	        if(i==0){
	            $(".slide .img[data-slide-imgId="+i+"]").attr("class",fy[slideNub-1]);
	        }else{
	           $(".slide .img[data-slide-imgId="+i+"]").attr("class",fy[i-1]); 
	        }
	    }
	    imgClickFy();
	    slideLi();
	}
	
	
	//左滑动
	function left(){
	    var fy = new Array();
	    for(i=0;i<slideNub;i++){
	        fy[i]=$(".slide .img[data-slide-imgId="+i+"]").attr("class");
	    }
	    for(i=0;i<slideNub;i++){
	        if(i==(slideNub-1)){
	            $(".slide .img[data-slide-imgId="+i+"]").attr("class",fy[0]);
	        }else{
	           $(".slide .img[data-slide-imgId="+i+"]").attr("class",fy[i+1]); 
	        }
	    }
	    imgClickFy();
	    slideLi();
	}
	
	
	//轮播图片左右图片点击翻页
	function imgClickFy(){
	    $(".slide .img").removeAttr("onclick");
	    $(".slide .img2").attr("onclick","left()");
	    $(".slide .img4").attr("onclick","right()");
	}
	
	
	//修改当前最中间图片对应按钮选中状态
	function slideLi(){
	    var slideList = parseInt($(".slide .img3").attr("data-slide-imgId")) + 1;
	    $(".slide-bt span").removeClass("on");
	    $(".slide-bt span[data-slide-bt="+slideList+"]").addClass("on");
	}
	
	
	//轮播按钮点击翻页
	function tz(id){
	    var tzcs = id - (parseInt($(".slide .img3").attr("data-slide-imgId")) + 1);
	    if(tzcs>0){
	        for(i=0;i<tzcs;i++){
	            setTimeout(function(){
	              right();  
	            },1);
	        }
	    }
	    if(tzcs<0){
	        tzcs=(-tzcs);
	        for(i=0;i<tzcs;i++){
	            setTimeout(function(){
	              left();  
	            },1);
	        }
	    }
	    slideLi();
	}
	
	
	//触摸滑动模块
	function k_touch() {
	    var _start = 0, _end = 0, _content = document.getElementById("slide");
	    _content.addEventListener("touchstart", touchStart, false);
	    _content.addEventListener("touchmove", touchMove, false);
	    _content.addEventListener("touchend", touchEnd, false);
	    function touchStart(event) {
	        var touch = event.targetTouches[0];
	        _start = touch.pageX;
	    }
	    function touchMove(event) {
	        var touch = event.targetTouches[0];
	        _end = (_start - touch.pageX);
	    }
	
	    function touchEnd(event) {
	        if (_end < -100) {
	            left();
	            _end=0;
	        }else if(_end > 100){
	            right();
	            _end=0;
	        }
	    }
	}
	
	}
//亲子
$('.whole3').click(function(){
	 var style=$('#style').val(1);
	   var style=$('#style').val();

})
//清新
$('.whole2').click(function(){
	$('#style').val(2);
	  var style=$('#style').val();
})
//简约
$('.whole4').click(function(){
	 var style=$('#style').val(3);
	   var style=$('#style').val();
})

function star(){
	
	var s=$('#style').val();
	var u=$('.userId').val();
	
     $.ajax({
    type:"get",
    url:"http://www.youyiku-yishu.cn/WebApp/AppPhotoBooks/buildBook",
    data:{style:s,userId:u},
    dataType:"json",
       beforeSend: function (XMLHttpRequest) {
         		XMLHttpRequest.setRequestHeader("DEVICEINFO", "JxRaZezavm3HXM3d9pWnYiqqQC1SJbsU");
       }
    }).then(data=>{
    	
    	var pbId=data.pbId;
  
    	if(data.status==1){
    		
			Cookies.set('pbId',pbId);
     	 location.href = "../photoNewbook/templet.html";
      }else{
        alert("创建失败");
      }
    });
}

// 	var  bpId=[{bpId:bpId}]
    	
//        将json转为字符串；
//	    var bpId = JSON.stringify(bpId[0]);
//	    console.log(bpId);
//	    将失信人信息存入cookie,这个存cookie的方法提前封装好
//	    setCookie("bpId", bpId,1);

